package com.ewhome.apartment.mvp.ui.adapter;

import android.content.Context;
import android.support.annotation.Nullable;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.alibaba.android.vlayout.DelegateAdapter;
import com.alibaba.android.vlayout.LayoutHelper;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ewhome.apartment.R;
import com.jess.arms.utils.ArmsUtils;

import java.util.List;

import cn.bingoogolapple.bgabanner.BGABanner;
import cn.bingoogolapple.bgabanner.BGALocalImageSize;

/**
 * author:zhangjing
 * 作用:
 * return:
 */

public class BannerAdapter extends DelegateAdapter.Adapter<BaseViewHolder>{

    private Context mContext;

    private LayoutHelper mLayoutHelper;

    private List<Integer> pics;
    public BannerAdapter(Context mContext, LayoutHelper mLayoutHelper) {
        this.mContext = mContext;
        this.mLayoutHelper = mLayoutHelper;
//        this.pics=pics;
    }

    @Override
    public LayoutHelper onCreateLayoutHelper() {
        return mLayoutHelper;
    }

    @Override
    public BaseViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view= ArmsUtils.inflate(mContext, R.layout.banner_view);
        return new BaseViewHolder(view);
    }

    @Override
    public void onBindViewHolder(BaseViewHolder holder, int position) {
        // Bitmap 的宽高在 maxWidth maxHeight 和 minWidth minHeight 之间
        BGALocalImageSize localImageSize = new BGALocalImageSize(720, 1280, 320, 640);
// 设置数据源
        holder.<BGABanner>getView(R.id.banner_guide_content).setData(localImageSize, ImageView.ScaleType.CENTER_CROP,
                R.drawable.timg,
                R.drawable.timg,
                R.drawable.timg);

    }

    @Override
    public int getItemCount() {
        return 1;
    }
}
